<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <jsp:include page="/common/backend_common.jsp"/>
    <%--<jsp:include page="/common/page.jsp"/>--%>
    <%--<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>--%>

    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.18.1/moment-with-locales.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css"
          rel="stylesheet"/>
    <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/assets/js/FileSaver.min.js"></script>
    <script type="text/javascript" src="/assets/js/tableExport.js"></script>
    <style type="text/css">
        .btn:focus,
        .btn:active:focus,
        .btn.active:focus,
        .btn.focus,
        .btn:active.focus,
        .btn.active.focus {
            outline: none;
        }
    </style>
</head>
<body class="no-skin"  style="background: white">


<input id="gritter-light" checked="" type="checkbox" class="ace ace-switch ace-switch-5"/>

<div class="page-header" style="margin-top: 0px">
    <h1>
        商砼任务单列表
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
            管理商砼任务单相关模块
        </small>
    </h1>
</div>
<div class="main-content-inner">
    <div class="col-sm-12">
        <div class="col-xs-12">
            <div class="table-header">
                操作列表
            </div>
            <div>
                <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
                    <div class="row">
                        <div class="row" style="margin-right: 0px;padding-right: 0px;">
                            <div class="col-xs-12">
                                <div class="dataTables_length" id="dynamic-table_length">
                                    <label>
                                        展示
                                        <select id="pageSize" name="dynamic-table_length" aria-controls="dynamic-table"
                                                class="form-control input-sm">
                                            <option value="10">10</option>
                                            <option value="25">25</option>
                                            <option value="50">50</option>
                                            <option value="100">100</option>
                                        </select> 条记录 </label>
                                    <input type="hidden" name="jbzCode" id="jbzCode"
                                           value="${sessionScope.user.jbzCode}"/>
                                    <label> &nbsp;&nbsp;类型
                                        <select id="search-type" name="dynamic-table_length"
                                                aria-controls="dynamic-table" class="form-control input-sm">
                                            <option value="">全部</option>
                                            <option value="0">未审核</option>
                                            <option value="1">已拒绝</option>
                                            <option value="2">已接收</option>
                                        </select></label>
                                    &nbsp;&nbsp;
                                    <input id="search-stUnit" type="search" name="stUnit" class="form-control input-sm"
                                           placeholder="施工单位" aria-controls="dynamic-table">
                                    <%--<input id="search-before" type="search" name="beforeSeg" class="form-control input-sm" placeholder="操作前的值" aria-controls="dynamic-table">--%>
                                    <%--<input id="search-after" type="search" name="afterSeg" class="form-control input-sm" placeholder="操作后的值" aria-controls="dynamic-table">--%>
                                    &nbsp;&nbsp;

                                    <div class='input-group date' id='datetimepicker1' style="width: 150px;">
                                        <input id="search-from" name="fromTime" class="form-control input-sm"
                                               placeholder="开始时间" aria-controls="dynamic-table"/>
                                        <span class="input-group-addon"><span
                                                class="glyphicon glyphicon-calendar"></span></span>
                                    </div>
                                    ~
                                    <div class='input-group date' id='datetimepicker2' style="width: 150px;">
                                        <input id="search-to" name="toTime" class="form-control input-sm"
                                               placeholder="结束时间" aria-controls="dynamic-table"/>
                                        <span class="input-group-addon"><span
                                                class="glyphicon glyphicon-calendar"></span></span>
                                    </div>
                                    &nbsp;&nbsp; &nbsp;&nbsp;
                                    <button class="btn btn-info  fa fa-check research" type="button">
                                        查询&nbsp;
                                    </button>
                                    &nbsp;&nbsp; &nbsp;&nbsp;
                                    <button class="btn btn-info export" type="button">
                                        <i class="glyphicon glyphicon-export icon-share"></i>&nbsp;导出表&nbsp;
                                    </button>
                                    &nbsp;&nbsp; &nbsp;&nbsp;
                                    <button class="btn btn-info remove" type="button">
                                        <i class="glyphicon glyphicon-remove icon-share"></i>&nbsp;删除&nbsp;
                                    </button>
                                </div>
                                <%--<input id="search-from"type="date" name="fromTime" class="form-control input-sm" placeholder="开始时间" aria-controls="dynamic-table"> ~--%>
                                <%--<input id="search-to" type="date" name="toTime" class="form-control input-sm" placeholder="结束时间" aria-controls="dynamic-table">--%>
                                <%--&nbsp;&nbsp;--%>

                            </div>
                        </div>
                        <div style="overflow:scroll;">
                        <table id="dynamic-table"
                               class="table table-striped table-bordered table-hover dataTable no-footer" role="grid"
                               aria-describedby="dynamic-table_info"
                               style="font-size:13px;min-width:100px; padding-right: 0px;margin-right: 0px">
                            <thead>
                            <tr role="row" style="text-align: center;">
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    修改状态
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    任务单详情
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    订单状态
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    任务单编号
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    施工单位
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    联系人
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    联系电话
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    强度等级
                                </th>
                                <th tabindex="0" aria-controls="dynamic-table" rowspan="1" colspan="1"
                                    style="text-align: center">
                                    数量
                                </th>


                            </tr>
                            </thead>
                            <tbody id="stRwdList"></tbody>
                        </table>
                        </div>
                        <div class="row" id="stRwdPage">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="dialog-contract-form" width="1500px" height="700px" style="display: none; width: 1500px;">
        <form id="contractForm">
            <table class="table-striped table-bordered table-hover dataTable no-footer" role="grid"
                   style="font-size:14px; font-weight : bold;table-layout: fixed;word-break: break-all;">

                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">编号</th>
                    <td id="orderConno" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">强度等级</th>
                    <td id="qddj" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">状态</th>
                    <td id="status" width="300px"></td>

                </tr>
                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">施工单位</th>
                    <td id="wxunitName" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">抗渗等级</th>
                    <td id="ksdj" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">供货日期</th>
                    <td id="supplyTime" width="300px"></td>

                </tr>
                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">工程名称</th>
                    <td id="wxproName" width="400px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">抗折等级</th>
                    <td id="kshedj" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">供货时间</th>
                    <td id="supplyTime1" width="300px"></td>

                </tr>
                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">浇筑部位</th>
                    <td id="pouringSite" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">防腐等级</th>
                    <td id="ffdj" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">订货数量</th>
                    <td id="orderQuantity" width="300px"></td>

                </tr>
                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">工程地址</th>
                    <td id="wxproAddress" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">阻锈要求</th>
                    <td id="zxyq" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">浇筑方式</th>
                    <td id="jzfs" width="300px"></td>

                </tr>
                <tr>

                    <th width="120px" height="40px" style="font-weight: normal">周边环境</th>
                    <td id="zbhj" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">坍落度</th>
                    <td id="slumps1" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">泵车台数</th>
                    <td id="bcts" width="300px"></td>

                </tr>
                <tr>

                    <th width="120px" height="40px" style="font-weight: normal">联系人</th>
                    <td id="contactName" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">其他要求</th>
                    <td id="otherRequire" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">下单时间</th>
                    <td id="xjTime" width="300px"></td>
                </tr>
                <tr>
                    <th width="120px" height="40px" style="font-weight: normal">联系电话</th>
                    <td id="contactPhone" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">备注</th>
                    <td id="bz" width="300px"></td>

                    <th width="120px" height="40px" style="font-weight: normal">臂长</th>
                    <td id="bc" width="300px"></td>
                </tr>

                <%--<tr>--%>
                <%--<th width="200px" height="40px" >施工单位</th><td id="wxunitName" width="600px"></td>--%>
                <%--</tr>--%>

            </table>
        </form>
    </div>

<script id="stRwdListTemplate" type="x-tmpl-mustache">
{{#stRwdList}}
<tr role="row" class="config odd" data-id="{{id}}"><!--even -->
    <td><a href="#" class="strwd-accept" data-id="{{id}}">接收</a>&nbsp|&nbsp<a href="#" class="strwd-refuse" data-id="{{id}}">拒绝</a> </td>
    <td><a href="#" class="contract-edit" data-id="{{id}}">任务单详情</a> </td>
    <td style='padding-top: 15px;padding-left: 15px'>{{#bold}}{{showStatus}}{{/bold}}</td> <!-- 此处套用函数对status做特殊处理 -->
    <td>{{orderConno}}</td>
     <td>{{wxunitName}}</td>
     <td>{{contactName}}</td>
     <td>{{contactPhone}}</td>
     <td>{{qddj}}</td>
     <td>{{orderQuantity}}m³</td>
</tr>
{{/stRwdList}}

</script>

<script id="paginateTemplate" type="x-tmpl-mustache">
<div class="col-xs-6">
    <div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">
        总共 {{total}} 中的 {{from}} ~ {{to}}
    </div>
</div>

<div class="col-xs-6">
    <div class="dataTables_paginate paging_simple_numbers" id="dynamic-table_paginate">
        <ul class="pagination">
            <li class="paginate_button previous {{^firstUrl}}disabled{{/firstUrl}}" aria-controls="dynamic-table" tabindex="0">
                <a href="#" data-target="1" data-url="{{firstUrl}}" class="page-action">首页</a>
            </li>
            <li class="paginate_button {{^beforeUrl}}disabled{{/beforeUrl}}" aria-controls="dynamic-table" tabindex="0">
                <a href="#" data-target="{{beforePageNo}}" data-url="{{beforeUrl}}" class="page-action">前一页</a>
            </li>
            <li class="paginate_button active" aria-controls="dynamic-table" tabindex="0">
                <a href="#" data-id="{{pageNo}}" >第{{pageNo}}页</a>
                <input type="hidden" class="pageNo" value="{{pageNo}}" />
            </li>
            <li class="paginate_button {{^nextUrl}}disabled{{/nextUrl}}" aria-controls="dynamic-table" tabindex="0">
                <a href="#" data-target="{{nextPageNo}}" data-url="{{nextUrl}}" class="page-action">后一页</a>
            </li>
            <li class="paginate_button next {{^lastUrl}}disabled{{/lastUrl}}" aria-controls="dynamic-table" tabindex="0">
                <a href="#" data-target="{{maxPageNo}}" data-url="{{lastUrl}}" class="page-action">尾页</a>
            </li>
        </ul>
    </div>
</div>

</script>

    <script type="text/javascript">

        $(function () {
            // $("th").css("white-space","nowrap");
            // $("td").css("white-space","nowrap");
            var stRwdListTemplate = $('#stRwdListTemplate').html();
            Mustache.parse(stRwdListTemplate);
            var stRwdMap = {};

            loadstRwdList();

            $(".research").click(function (e) {
                e.preventDefault();
                $("#stRwdPage .pageNo").val('1');
                loadstRwdList();
            });

            $(".export").click(function (e) {
                e.preventDefault();
                var stUnit = encodeURI($("#search-stUnit").val().replace(/\s+/g, ""));
                var fromTime = $("#search-from").val();
                var toTime = $("#search-to").val();
                var type = $("#search-type").val();
                var jbzCode = $("#jbzCode").val();
                location.href = "/sys/stRwd/export?type="+type+"&stUnit="+stUnit+"&fromTime="+fromTime+"&toTime="+toTime+"&jbzCode="+jbzCode;
            });

            $(".remove").click(function (e) {
                e.preventDefault();
                var stUnit = $("#search-stUnit").val().replace(/\s+/g, "");
                var fromTime = $("#search-from").val();
                var toTime = $("#search-to").val();
                var type = $("#search-type").val();
                var jbzCode = $("#jbzCode").val();
                if((fromTime == null || fromTime == '') && (toTime == null || toTime=='')
                    && (stUnit == null || stUnit=='')&& (type == null || type=='')){
                    showMessage("删除所选任务单失败:", "不允许全部删除操作，若必须全部删除，请选择较大时间段！", false);
                }else{
                var url = "/sys/stRwd/remove";
                $.ajax({
                    url: url,
                    data: {
                        stUnit:stUnit,
                        fromTime: fromTime,
                        toTime: toTime,
                        type: type,
                        jbzCode: jbzCode
                    },
                    type: 'post',
                    success: function (result) {
                        if (result.ret) {
                            showMessage("删除所选任务单:", "操作成功", true);
                            $("#stRwdPage .pageNo").val('1');
                            loadstRwdList();
                        } else {
                            showMessage("删除所选任务单失败:", result.msg, false);
                        }
                    }
                });
                }
            });



            function loadstRwdList() {
                var pageSize = $("#pageSize").val();
                var pageNo = $("#stRwdPage .pageNo").val() || 1;
                console.log("------------1pageNo"+pageNo);
                var stUnit = $("#search-stUnit").val().replace(/\s+/g, "");
                var fromTime = $("#search-from").val();
                var toTime = $("#search-to").val();
                var type = $("#search-type").val();
                var url = "/sys/stRwd/page.json";
                var jbzCode = $("#jbzCode").val();
                $.ajax({
                    url: url,
                    data: {
                        pageNo: pageNo,
                        pageSize: pageSize,
                        stUnit: stUnit,
                        fromTime: fromTime,
                        toTime: toTime,
                        type: type,
                        jbzCode: jbzCode
                    },
                    type: 'post',
                    success: function (result) {
                        renderstRwdListAndPage(result, url);
                    }
                });
            }

            $(function () {
                $('#datetimepicker1').datetimepicker({
                    format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn')
                });
                $('#datetimepicker2').datetimepicker({
                    format: 'YYYY-MM-DD',
                    locale: moment.locale('zh-cn')
                });
            });

            function renderstRwdListAndPage(result, url) {
                if (result.ret) {
                    if (result.data.total > 0) {
                        var rendered = Mustache.render(stRwdListTemplate, {
                            "stRwdList": result.data.data,
                            "showType": function () {
                                return function (text, render) {
                                    var typeStr = "";
                                    switch (this.type) {
                                        case 0:
                                            typeStr = "未审核";
                                            break;
                                        case 1:
                                            typeStr = "已拒绝";
                                            break;
                                        case 2:
                                            typeStr = "已接收";
                                            break;
                                    }
                                    return typeStr;
                                }
                            },
                            "showStatus": function () {
                                return this.status == 1 ? '已拒绝' : (this.status == 0 ? '未审核' : '已接收');
                            },
                            "bold": function () {
                                return function (text, render) {
                                    var status = render(text);
                                    if (status == '已拒绝') {
                                        return "<span class='label  label-success'>已拒绝</span>";
                                    } else if (status == '未审核') {
                                        return "<span class='label  label-default'>未审核</span>";
                                    } else {
                                        return "<span class='label label-warning'>已接收</span>";
                                    }
                                }
                            },
                            "showDate": function () {
                                return function (text, render) {
                                    return new Date(this.operateTime).Format("yyyy-MM-dd hh:mm:ss");
                                }
                            },
                            "showOldValue": function () {
                                return function (text, render) {
                                    return this.oldValue ? ((this.type == 6 || this.type == 7) ? this.oldValue : formatJson(this.oldValue)) : '无';
                                }
                            },
                            "showNewValue": function () {
                                return function (text, render) {
                                    return this.newValue ? ((this.type == 6 || this.type == 7) ? this.newValue : formatJson(this.newValue)) : '无';
                                }
                            }
                        });
                        $('#stRwdList').html(rendered);
                        $.each(result.data.data, function (i, stRwd) {
                            stRwdMap[stRwd.id] = stRwd;
                        });
                    } else {
                        $('#stRwdList').html('');
                    }
                    bindstRwdClick();
                    bindstRwdClick1();
                    bindstRwdClick2();
                    var pageSize = $("#pageSize").val();
                    var pageNo = $("#stRwdPage .pageNo").val() || 1;
                    console.log("------------2pageNo"+pageNo);
                    renderPage(url, result.data.total, pageNo, pageSize, result.data.total > 0 ? result.data.data.length : 0, "stRwdPage", renderstRwdListAndPage);
                } else {
                    showMessage("获取操作列表", result.msg, false);
                }
            }


            var paginateTemplate = $("#paginateTemplate").html();
            Mustache.parse(paginateTemplate);

            function renderPage(url, total, pageNo, pageSize, currentSize, idElement, callback) {
                var maxPageNo = Math.ceil(total / pageSize);
                console.log("maxPageNo"+maxPageNo);
                var paramStartChar = url.indexOf("?") > 0 ? "&" : "?";
                var from = (pageNo - 1) * pageSize + 1;
                console.log("from"+from+"pageNo"+pageNo);
                var view = {
                    from: from > total ? total : from,
                    to: (from + currentSize - 1) > total ? total : (from + currentSize - 1),
                    total: total,
                    pageNo: Number(pageNo),
                    maxPageNo: maxPageNo,
                    nextPageNo: Number(pageNo) >= maxPageNo ? maxPageNo : (Number(pageNo) + 1),
                    beforePageNo: pageNo == 1 ? 1 : (pageNo - 1),
                    firstUrl: (pageNo == 1) ? '' : (url + paramStartChar + "pageNo=1&pageSize=" + pageSize),
                    beforeUrl: (pageNo == 1) ? '' : (url + paramStartChar + "pageNo=" + (Number(pageNo) - 1) + "&pageSize=" + pageSize),
                    nextUrl: (pageNo >= maxPageNo) ? '' : (url + paramStartChar + "pageNo=" + (Number(pageNo) + 1) + "&pageSize=" + pageSize),
                    lastUrl: (pageNo >= maxPageNo) ? '' : (url + paramStartChar + "pageNo=" + maxPageNo + "&pageSize=" + pageSize)
                };
                $("#" + idElement).html(Mustache.render(paginateTemplate, view));

                $(".page-action").click(function (e) {
                    e.preventDefault();
                    $("#" + idElement + " .pageNo").val($(this).attr("data-target"));
                    var targetUrl = $(this).attr("data-url");
                    var stUnit = $("#search-stUnit").val().replace(/\s+/g, "");
                    // MessageBox.show(stUnit);
                    // alert(stUnit);
                    var fromTime = $("#search-from").val();
                    var toTime = $("#search-to").val();
                    var type = $("#search-type").val();
                    var jbzCode = $("#jbzCode").val();
                    if (targetUrl != '') {
                        $.ajax({
                            url: targetUrl,
                            data: {
                                stUnit: stUnit,
                                fromTime: fromTime,
                                toTime: toTime,
                                type: type,
                                jbzCode: jbzCode
                            },
                            type: 'post',
                            success: function (result) {
                                if (callback) {
                                    callback(result, url);
                                }
                            }
                        })
                    }
                })
            }


            function bindstRwdClick2() {
                $(".strwd-refuse").click(function (e) {
                    e.preventDefault();
                    var stRwdId = $(this).attr("data-id"); // 选中的stRwd id
                    if (true) {
                        $.ajax({
                            url: "/sys/stRwd/updateById",
                            data: {
                                id: stRwdId,
                                status: 1,
                            },
                            success: function (result) {
                                if (result.ret) {
                                    loadstRwdList();
                                } else {
                                    alert("操作失败！请刷新重试")
                                }
                            }
                        });
                    }
                });
            }

            function bindstRwdClick1() {
                $(".strwd-accept").click(function (e) {
                    e.preventDefault();
                    var stRwdId = $(this).attr("data-id"); // 选中的stRwd id
                    if (true) {
                        $.ajax({
                            url: "/sys/stRwd/updateById",
                            data: {
                                id: stRwdId,
                                status: 2,
                            },
                            success: function (result) {
                                if (result.ret) {
                                    loadstRwdList();
                                } else {
                                    alert("操作失败！请刷新重试")
                                }
                            }
                        });
                    }
                });
            }

            function bindstRwdClick() {
                $(".contract-edit").click(function (e) {
                    e.preventDefault();
                    e.stopPropagation();
                    var stRwdId = $(this).attr("data-id");
                    $("#dialog-contract-form").dialog({
                        model: true,
                        title: "任务单详情",
                        open: function (event, ui) {
                            $(".ui-dialog-titlebar-close", $(this).parent()).hide();
                            $("#contractForm")[0].reset();

                            var data = stRwdMap[stRwdId];
                            if (data.status == 0) {
                                data.status = "<span class='label  label-default'>未审核</span>"
                            } else if (data.status == 1) {
                                data.status = "<span class='label  label-success'>已拒绝</span>"
                            } else {
                                data.status = "<span class='label label-warning'>已接收</span>"
                            }

                            if (data.jzfs == 0) {
                                data.jzfs = "自卸"
                            } else if (data.jzfs == 1) {
                                data.jzfs = "泵送"
                            } else if (data.jzfs == 2) {
                                data.jzfs = "地泵"
                            } else if (data.jzfs == 3) {
                                data.jzfs = "塔吊"
                            } else if (data.jzfs == 4) {
                                data.jzfs = "车倒"
                            } else if (data.jzfs == 5) {
                                data.jzfs = "地上"
                            } else if (data.jzfs == 6) {
                                data.jzfs = "电泵"
                            } else if (data.jzfs == 7) {
                                data.jzfs = "象泵"
                            } else if (data.jzfs == 8) {
                                data.jzfs = "其它"
                            }
                            if (data) {
                                $("#orderConno").html(data.orderConno);
                                $("#status").html(data.status);
                                $("#wxunitName").html(data.wxunitName);
                                $("#wxproName").html(data.wxproName);
                                $("#wxproAddress").html(data.wxproAddress);
                                $("#contactName").html(data.contactName);
                                $("#contactPhone").html(data.contactPhone);
                                $("#pouringSite").html(data.pouringSite);
                                $("#supplyTime").html(new Date(data.supplyTime).Format("yyyy-MM-dd"));
                                $("#xjTime").html(new Date(data.xjTime).Format("yyyy-MM-dd"));
                                $("#supplyTime1").html(data.supplyTime1);
                                $("#jzfs").html(data.jzfs);
                                $("#qddj").html(data.qddj);
                                $("#ksdj").html(data.ksdj);
                                $("#kshedj").html(data.kshedj);
                                $("#ffdj").html(data.ffdj);
                                $("#zxyq").html(data.zxyq);
                                $("#otherRequire").html(data.otherRequire);
                                $("#slumps1").html(data.slumps1 + "±" + data.slumps2 + "(mm)");
                                $("#orderQuantity").html(data.orderQuantity + "(m³)");
                                $("#bz").html(data.bz);
                                $("#zbhj").html(data.zbhj);
                                $("#bcts").html(data.bcts);
                                $("#bc").html(data.bc);

                            };
                            $('.ui-dialog-buttonpane').find('button:first').addClass('btn').addClass('btn-warning').addClass('fa').addClass('fa-check');
                            $('.ui-dialog-buttonpane').find('button').eq(1).addClass('btn').addClass('btn-success').addClass('fa').addClass('fa-times');
                            $('.ui-dialog-buttonpane').find('button:last').addClass('btn').addClass('btn-default').addClass('fa').addClass('fa-reply');
                        },
                        buttons: {
                            "接收": function () {
                                if (true) {
                                    $.ajax({
                                        url: "/sys/stRwd/updateById",
                                        data: {
                                            id: stRwdId,
                                            status: 2,
                                        },
                                        success: function (result) {
                                            if (result.ret) {
                                                loadstRwdList();
                                                $("#status").html("<span class='label label-warning'>已接收</span>");
                                            } else {
                                                alert("操作失败！请刷新重试")
                                            }
                                        }
                                    });
                                }
                            },
                            "拒绝": function () {
                                if (true) {
                                    $.ajax({
                                        url: "/sys/stRwd/updateById",
                                        data: {
                                            id: stRwdId,
                                            status: 1,
                                        },
                                        success: function (result) {
                                            if (result.ret) {
                                                loadstRwdList();
                                                $("#status").html("<span class='label  label-success'>已拒绝</span>");
                                            } else {
                                                alert("操作失败！请刷新重试")
                                            }
                                        }
                                    });
                                }

                            },
                            "返回": function () {
                                $("#dialog-contract-form").dialog("close");
                            }
                        }
                    });
                    $(".ui-dialog").css({
                        width: "88%",
                        "text-align": "center",
                        position: "fixed",
                        left: "6%",
                        top: "10%"
                    })
                });
            }

            Date.prototype.Format = function (fmt) { //author: meizz
                var o = {
                    "M+": this.getMonth() + 1, //月份
                    "d+": this.getDate(), //日
                    "h+": this.getHours(), //小时
                    "m+": this.getMinutes(), //分
                    "s+": this.getSeconds(), //秒
                    "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                    "S": this.getMilliseconds() //毫秒
                };
                if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                for (var k in o)
                    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                return fmt;
            };
            var formatJson = function (json, options) {
                if (json == '') return '';
                var reg = null,
                    formatted = '',
                    pad = 0,
                    PADDING = '    '; // one can also use '\t' or a different number of spaces

                // optional settings
                options = options || {};
                // remove newline where '{' or '[' follows ':'
                options.newlineAfterColonIfBeforeBraceOrBracket = (options.newlineAfterColonIfBeforeBraceOrBracket === true) ? true : false;
                // use a space after a colon
                options.spaceAfterColon = (options.spaceAfterColon === false) ? false : true;

                // begin formatting...
                if (typeof json !== 'string') {
                    // make sure we start with the JSON as a string
                    json = JSON.stringify(json);
                } else {
                    // is already a string, so parse and re-stringify in order to remove extra whitespace
                    json = JSON.parse(json);
                    json = JSON.stringify(json);
                }

                // add newline before and after curly braces
                reg = /([\{\}])/g;
                json = json.replace(reg, '\r\n$1\r\n');

                // add newline before and after square brackets
                reg = /([\[\]])/g;
                json = json.replace(reg, '\r\n$1\r\n');

                // add newline after comma
                reg = /(\,)/g;
                json = json.replace(reg, '$1\r\n');

                // remove multiple newlines
                reg = /(\r\n\r\n)/g;
                json = json.replace(reg, '\r\n');

                // remove newlines before commas
                reg = /\r\n\,/g;
                json = json.replace(reg, ',');

                // optional formatting...
                if (!options.newlineAfterColonIfBeforeBraceOrBracket) {
                    reg = /\:\r\n\{/g;
                    json = json.replace(reg, ':{');
                    reg = /\:\r\n\[/g;
                    json = json.replace(reg, ':[');
                }
                if (options.spaceAfterColon) {
                    reg = /\:/g;
                    json = json.replace(reg, ': ');
                }

                $.each(json.split('\r\n'), function (index, node) {
                    var i = 0,
                        indent = 0,
                        padding = '';

                    if (node.match(/\{$/) || node.match(/\[$/)) {
                        indent = 1;
                    } else if (node.match(/\}/) || node.match(/\]/)) {
                        if (pad !== 0) {
                            pad -= 1;
                        }
                    } else {
                        indent = 0;
                    }

                    for (i = 0; i < pad; i++) {
                        padding += PADDING;
                    }

                    formatted += padding + node + '\r\n';
                    pad += indent;
                });
                return formatted;
            };

        });
    </script>
</body>
</html>